package org.web.webdisplay.server.biz.impl;

import org.springframework.stereotype.Service;
import org.web.webdisplay.sdk.biz.VerifyIdentityBiz;
import org.web.webdisplay.sdk.dto.VerifyIdentityDTO;

@Service("verifyIdentityBiz")
public class VerifyIdentityBizImpl extends AbstractVerifyIdentityBizImpl implements VerifyIdentityBiz {


    @Override
    public void generateVerifyCode(VerifyIdentityDTO verifyIdentityDTO) {
        if (verifyIdentityDTO.getVerifyMark().isEmpty()) {
            String verifyCode = generateRandomVerifyCode();
            verifyIdentityDTO.setVerifyMark(verifyCode);
        }
    }


    /**
     * 生成六位随机数字验证码
     * */
    private String generateRandomVerifyCode() {
        String verifyCode = "";
        for (int i = 0; i < 6; i++) {
            verifyCode += (int) (Math.random() * 10);
        }
        return verifyCode;
    }
}
